
$(function () {
    $("span.ljtip").ljDetail($("#xsdexamine_detail_ljtip").val(), {
        position: 'top'
    });

    $("#xsdexamine_xsdexaminemx_table").datagrid({
        url: $.webPath() + '/xsgl/xsdgl/xsdgl_xsmx?xsdId=' + $("#xsdexaminedetail_id").val(),
        width:1700,
        fitColumns: false,
        singleSelect: true,
        fit: true,
        showFooter: true,
        rownumbers: true,
        columns: [
            [
                {field: 'wzgg.oldcode', title: '老物资编码',align: 'center',width: 150},
                {field: 'wzgg.code', title: '物资编码', width: 150,align: 'center'},
                {field: 'wzgg.name', title: '物资名称', width: 100,align: 'center'},
                {field: 'wzgg.ggxh', title: '规格型号', width: 100,align: 'center'},
                {field: 'wzgg.th', title: '图号', width: 50,align: 'center'},
                {field: 'wzgg.dw', title: '单位', width: 50,align: 'center'},
                //{field: 'cd.z', title: '产地', width: 50},
                {field: 'jzfs.z', title: '记重方式', width: 50,align: 'center'},
                {field: 'kh.khbm', title: '卡号', width: 120,align: 'center'},
                {field: 'xscb', title: '销售成本(元)', align: 'right',width: 150, formatter: function (value) {
                    var sl = formatSlForHtml(value, ",");
                    return sl;
                }},
                {field: 'js', title: '件数', width: 50,align: 'right'},
                {field: 'sbsl', title: '数量', width: 100, align: 'right',
                    formatter: function (value) {
                        var sl = formatSlForHtml(value, ",");
                        return sl;
                    }},
                {field: 'hsj', title: '含税价(元)', width: 150,align: 'right',
                    formatter: function (value) {
                        var sl = formatJeForHtml(value, ",");
                        return sl;
                    } },
                {field: 'hse', title: '含税额(元)', width: 150, align: 'right',
                    formatter: function (value) {
                        var sl = formatJeForHtml2(value, ",");
                        return sl;
                    } },
                {field: 'bhsj', title: '不含税价(元)', width: 150,align: 'right',
                    formatter: function (value) {
                        var sl = formatJeForHtml(value, ",");
                        return sl;
                    } },
                {field: 'bhse', title: '不含税额(元)', width: 150, align: 'right',
                    formatter: function (value) {
                        var sl = formatJeForHtml2(value, ",");
                        return sl;
                    } }

            ]
        ],
        onLoadSuccess:function(){
            $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
        },
        loadFilter: function (data) {
            $.each(data.rows, function () {
                if (this.bhsj) {
                    this.bhse = this.bhsj * this.sbsl;
                }
                if (this.hsj) {
                    this.hse = this.hsj * this.sbsl;
                }
            })
            return data;
        }
    })
})

function viewXsdexamineXshtDetail(id) {
    $.window({
        iconCls: 'icon-tip',
        title: "详细信息",
        url: $.webPath() + "/htgl/xshtgl/xshtgl_detail?xshtId=" + id,
        width: 1050,
        height: 500,
        modal: true,
        isMax: false
    })
}






